import request from "../request/request";

// 管理员查询所有用户
export function selectAllCustomers(pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectAllCustomers',
        method: 'get',
        params: {
            pageNumber,
            pageSize
        }
    })
}

// 通过名字模糊查找客户
export function selectCustomersByName(customername, pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectCustomersByName',
        method: 'get',
        params: {
            customername,
            pageNumber,
            pageSize
        }
    })
}

// 查看所有用户订单
export function selectAllCustomerOrders(pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectAllCustomerOrders',
        method: 'get',
        params: {
            pageNumber,
            pageSize
        }
    })
}

// 查看客户的订购详情
export function selectAllCustomerData(pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectAllCustomerData',
        method: 'get',
        params: {
            pageNumber,
            pageSize
        }
    })
}

// 查看客户的每年订购信息
export function selectYearlyOrder(username) {
    return request({
        url: '/api/admin/selectYearlyOrder',
        method: 'get',
        params: {
            username
        }
    })
}

export function selectSupplierData(pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectSupplierData',
        method: 'get',
        params: {
            pageNumber,
            pageSize
        }
    })
}

export function setOrderStatus(role, orderid, code) {
    return request({
        url: '/api/admin/setOrderStatus',
        method: 'get',
        params: {
            role,
            orderid,
            code
        }
    })
}


export function selectCustomerOrdersByOrderId(orderid, pageNumber, pageSize) {
    return request({
        url: '/api/admin/selectCustomerOrdersByOrderId',
        method: 'get',
        params: {
            orderid,
            pageNumber,
            pageSize
        }
    })
}